<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class CommissionResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'user_id' => $this->user->id,
            'user_name' => $this->user->nickname,
            'user_avatar' => $this->user->avatar,
            'order_id' => $this->order->id,
            'order_payment' => $this->order->payment,
            'order_status' => $this->order->status,
            'order_created_at' => $this->order->updated_at,
            'status' => $this->status,
            'amount' => $this->amount,
            'created_at' => $this->created_at->toDateTimeString(),
            'updated_at' => $this->updated_at->toDateTimeString(),
        ];
    }
}
